<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    *{
        margin: 0;padding: 0;
        list-style: none;
    }
    .tab{
        margin: 50px;
        width: 400px;height: 300px;
        display: flex;
        flex-direction: column;
    }
    .btns{
        height: 50px;
        background-color: aqua;
        display: flex;
    }
    .btn{
        flex: 1;
        display: flex;
        justify-content: center;
        align-items: center;
    }
    .btn.active{
        background-color: brown;
    }
    .contents{
        flex: 1;
        background-color: blueviolet;
        display: flex;
    }
    .content{
        width: 100%;height: 100%;
        display: none;
        justify-content: center;
        align-items: center;
    }
    .content.active{
        display: flex;
    }
</style>
<body>
    <div class="tab">
        <ul class="btns">
            <li :class="{btn:true,active:item.aaa}" v-for="(item,index) in arr" @mouseover="handlerTab(index)">{{ item.btn }}</li>
            
        </ul>
        <ul class="contents">
            <li :class="{content:true,active:item.aaa}" v-for="(item,index) in arr">{{ item.content }}</li>
        </ul>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
    <script>
        new Vue({
            el : ".tab",
            data : {
                length : 4,
                arr : [
                    {
                        btn : 1,
                        content : "内容1",
                        aaa : true
                    },
                    {
                        btn : 2,
                        content : "内容2",
                        aaa : false
                    },
                    {
                        btn : 3,
                        content : "内容3",
                        aaa : false
                    },
                    {
                        btn : 4,
                        content : "内容4",
                        aaa : false
                    },
                ]
            },
            methods : {
                handlerTab(index){
                    this.arr.map((item) =>{item.aaa = false});
                    this.arr[index].aaa = true;

                }
            }
        })
    </script>
</body>
</html>